package com.zuikaku.nettychat.service.impl;

import com.zuikaku.nettychat.vo.FriendVO;
import com.zuikaku.nettychat.dao.FriendMapper;
import com.zuikaku.nettychat.pojo.Friend;
import com.zuikaku.nettychat.service.FriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FriendServiceImpl implements FriendService {
    @Autowired
    private FriendMapper friendMapper;

    @Override
    public int addFriendByFriend(Friend friend) {
        return friendMapper.insertSelective(friend);
    }

    @Override
    public Friend getFriendByPK(int friendId) {
        return friendMapper.selectByPrimaryKey(friendId);
    }

    @Override
    public int updateFriendByFriend(Friend friend) {
        return friendMapper.updateByPrimaryKeySelective(friend);
    }

    @Override
    public List<FriendVO> getFriendVOByUserId(Integer userId) {
        return friendMapper.getFriendVOByUserId(userId);
    }
}
